Developer Documentation

QuickTime 4 API Documentation

QuickTime Streaming

| Previous | Chapter Contents | Chapter Top | Next |

Calling the Packet Builder

The actual work your packetizer does in the RTPMPSetSampleData or RTPMPIdle function consists of creating packets. This is done by making calls to a packet builder component. The packet builder functions are defined in QTStreamingComponents.h and described in "Packet Builder Functions" .

The first thing you will need to do is to begin a new packet group. To start a new group of packets, call RTPPBBeginPacketGroup . Packets in a single group have the same RTP time stamp (and go into the same hint sample, if the data is being used to create a hint track).

Next, you will want to add one or more packets to the group. Call RTPPBBeginPacket to begin a single network packet.

Call RTPPBAddPacketLiteralData to add literal data to the packet, such as header information.

Call RTPPBAddPacketSampleData to add a sample reference to the packet, such as the sample data specified in inSampleDataParams in a call to your packetizer's RTPMPSetSampleData function.

You may want to packetize the same data repeatedly. There are utility functions to make this easier. Begin by passing in RTPPacketRepeatedDataRef to RTPPBAddPacketLiteralData or RTPPBAddPacketSampleData , depending on whether you want to repeat literal data or sample data. The packet builder will store a copy of the data and return a data reference. You then call RTPPBAddPacketRepeatedData with the data reference whenever you want to add copies of the data. Call RTPPBReleaseRepeatedData when you are done with the data. The packet builder will maintain a copy of the data until you release it.

End a packet by calling RTPPBEndPacket .

End the group of packets by calling RTPPBEndPacketGroup .

Note that it is legal to have more than one packet group open at a time, or to have more than one packet open at a time. Packet groups are sent in the order they are closed ( RTPPBEndPacketGroup ). Packets within a group are also sent in the order they are closed ( RTPPBEndPacket ).


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |